function isObj(obj = {}) {
    return typeof obj === 'object' && obj !== null
}

function isEqual(obj1 = {}, obj2 = {}) {
    if (!isObj(obj1) || !isObj(obj2)) {
        return obj1 === obj2
    }
    if (obj1 === obj2) {
        return true
    }
    if (Object.keys(obj1).length !== Object.keys(obj2).length) {
        return false
    }
    for (let key in obj1) {
        // 比较当前 key 的 val —— 递归！！！
        const res = isEqual(obj1[key], obj2[key])
        if (!res) {
            return false
        }
    }
    return true
}

let obj1 = {
    a: 1,
    b: 2,
    c: 3,
    d: {
        e: {
            f: 34
        }
    }
}

let obj2 = {
    a: 1,
    b: 2,
    c: 3,
    d: {
        e: {
            f: 6
        }
    }
}

let res = isEqual(obj1, obj2);
console.log(res)